/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.admin.mapper;

import cn.hutool.core.date.DateTime;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.admin.dto.ContractAgreeDTO;
import org.springblade.modules.admin.entity.ContractAgree;
import org.springblade.modules.admin.entity.ElevatorContract;
import org.springblade.modules.admin.entity.MaintainPlanConfig;
import org.springblade.modules.admin.vo.ContractAgreeVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.admin.vo.contract.ContractElevatorVo;
import org.springblade.modules.admin.vo.contract.ElevatorAgreeVo;

import java.util.Date;
import java.util.List;

/**
 * 合同协议 Mapper 接口
 *
 * @author ysq
 * @since 2025-03-27
 */
public interface ContractAgreeMapper extends BaseMapper<ContractAgree> {


	/**
	 * 查询列表
	 * @param page 分页
	 * @param contractAgreeDTO 查询条件
	 * @return 数据集
	 */
	List<ContractAgreeVO> pageList(IPage<ContractAgreeVO> page, @Param("contractAgreeDTO") ContractAgreeDTO contractAgreeDTO);


	/**
	 * 昨日新增合同或者协议未排班的电梯数量
	 * @param yesterday 日期
	 * @return 电梯id
	 */
    List<ElevatorContract> notPlanEleHasContract(Integer  yesterday);

	/**
	 * 获取电梯合同
	 * @param elevatorId 电梯id
	 * @return 数据集
	 */
	List<ElevatorAgreeVo> getElevatorConList(@Param("elevatorId")Long elevatorId);

	/**
	 * 获取电梯协议
	 * @param elevatorId 电梯id
	 * @return 数据集
	 */
	List<ElevatorAgreeVo> getElevatorAgreeList(@Param("elevatorId") Long elevatorId);


	/**
	 * 根据合同获取电梯的维保状态
	 * @param contractId 合同id
	 * @return 数据集
	 */
    List<MaintainPlanConfig> getElevatorContract(@Param("contractId") Long contractId);

	/**
	 * 获取有协议没有电梯维保的电梯数
	 * @param date 时间
	 * @return 电梯ids
	 */
    List<ElevatorContract> getNotPlan(@Param("date") Date date,@Param("elevatorId") Long elevatorId);
}
